<?php
return [
    'adminEmail' => 'admin@example.com',

    'oauth2_server_host' => 'http://oauth2server:7216',


    //API分类
    'apiCategories' => [

        ['id' => 1, 'name' => '获取令牌',],
        ['id' => 2, 'name' => '获取授权码',],
        ['id' => 3, 'name' => '订单相关',],
    ],

    //API
    'apis' => [
        [
            'cid' => 1,
            'name' => '获取令牌',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html',
            'method' => 'POST',
            'isAuth' => false,
            'params' => [
                ["name"=>"grant_type", "necessary"=>true, "type"=>"enum", "options"=>[
                    ["name"=>"客户端模式", "value"=>"client_credentials"],
                    ["name"=>"授权码模式", "value"=>"authorization_code"],
                    ["name"=>"密码模式", "value"=>"password"],
                ], "default"=>"client_credentials", "intro"=>""],
                ["name"=>"client_id", "necessary"=>true, "type"=>"string", "default"=>"testclient", "intro"=>""],
                ["name"=>"client_secret", "necessary"=>true, "type"=>"string", "default"=>"testpass", "intro"=>""],
                ["name"=>"code", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>""],
                ["name"=>"username", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>"用户名"],
                ["name"=>"password", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>"密码"],
            ]
        ],
        [
            'cid' => 1,
            'name' => '获取令牌（授权码模式）',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html?grant_type=authorization_code',
            'method' => 'POST',
            'isAuth' => false,
            'params' => [
                ["name"=>"grant_type", "necessary"=>true, "type"=>"string", "value"=>"authorization_code", "default"=>"", "intro"=>"认证模式"],
                ["name"=>"client_id", "necessary"=>true, "type"=>"string", "default"=>"testclient", "intro"=>""],
                ["name"=>"client_secret", "necessary"=>true, "type"=>"string", "default"=>"testpass", "intro"=>""],
                ["name"=>"code", "necessary"=>true, "type"=>"string", "default"=>"", "intro"=>""],
                ["name"=>"redirect_uri", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>"redirect_uri"],
            ]
        ],
        [
            'cid' => 1,
            'name' => '获取令牌（简化模式）（未完）',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html?grant_type=implicit',
            'method' => 'POST',
            'isAuth' => false,
            'params' => [
                ["name"=>"client_id", "necessary"=>true, "type"=>"string", "default"=>"testclient", "intro"=>""],
                ["name"=>"client_secret", "necessary"=>true, "type"=>"string", "default"=>"testpass", "intro"=>""],
                ["name"=>"code", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>""],
                ["name"=>"username", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>"用户名"],
                ["name"=>"password", "necessary"=>false, "type"=>"string", "default"=>"", "intro"=>"密码"],
            ]
        ],
        [
            'cid' => 1,
            'name' => '获取令牌（客户端模式）',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html?grant_type=client_credentials',
            'method' => 'POST',
            'isAuth' => false,
            'params' => [
                ["name"=>"grant_type", "necessary"=>true, "type"=>"string", "value"=>"client_credentials", "default"=>"", "intro"=>"认证模式"],
                ["name"=>"client_id", "necessary"=>true, "type"=>"string", "default"=>"testclient", "intro"=>""],
                ["name"=>"client_secret", "necessary"=>true, "type"=>"string", "default"=>"testpass", "intro"=>""],
            ]
        ],
        [
            'cid' => 1,
            'name' => '获取令牌（密码模式）',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html?grant_type=password',
            'method' => 'POST',
            'isAuth' => false,
            'params' => [
                ["name"=>"grant_type", "necessary"=>true, "type"=>"string", "value"=>"password", "default"=>"", "intro"=>"认证模式"],
                ["name"=>"client_id", "necessary"=>true, "type"=>"string", "default"=>"testclient", "intro"=>""],
                ["name"=>"client_secret", "necessary"=>true, "type"=>"string", "default"=>"testpass", "intro"=>""],
                ["name"=>"username", "necessary"=>false, "type"=>"string", "default"=>"admin", "intro"=>"用户名"],
                ["name"=>"password", "necessary"=>false, "type"=>"string", "default"=>"123456", "intro"=>"密码"],
            ]
        ],
        [
            'cid' => 2,
            'name' => '获取授权码',
            'link' => 'http://oauth2server:7216/oauth2/authorize.html?response_type=code&client_id=testclient&state=xyz',
            'host' => 'oauth',
            'uri' => '/oauth2/token.html',
            'method' => 'POST',
            'isAuth' => false,
            'params' => []
        ],
        [
            'cid' => 3,
            'name' => '产品列表',
            'host' => 'yuxun',
            'uri' => '/product/list.html',
            'method' => 'GET',
            'isAuth' => false,
            'intro' => '如果是POST，必须是x-www-form-urlencoded参数，也可以GET传参',
            'params' => [
                ["name"=>"access_token", "necessary"=>true, "type"=>"string", "default"=>"", "intro"=>"token"],
            ]
        ],
    ],
];
